<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateServicesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('services', function (Blueprint $table) {
            $table->id();
            $table->string('title')->comment('服务标题');
            $table->enum('type', ['sound', 'video'])->default('sound')->comment('服务类型');
            $table->string('description')->nullable()->comment('服务描述');
            $table->string('image')->comment('服务图片');
            $table->text('content')->comment('服务内容');
            $table->json('links')->nullable()->comment('服务链接');
            $table->integer('orderby')->default(0)->comment('排序');
            $table->tinyInteger('hide')->default(0)->comment('是否隐藏');
            $table->integer('readnum')->default(0)->comment('阅读量');
            $table->timestamp('published_at')->default(now())->comment('发布时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('services');
    }
}
